﻿#if UNITY_EDITOR
using UnityEngine;
using UnityEditor;
using System.Collections.Generic;

public class DummyScenarioEditor
{
    [MenuItem("ScenarioEditor/CreateBeginnerScenario")]
    public static void CreateBeginnerScenario()
    {
        Scenario scenario = ScriptableObject.CreateInstance<Scenario>();
        scenario.name = "Beginner";
        scenario.Description = "Beginner Scenario";
        scenario.MapWidth = scenario.MapHeight = 11;
        scenario.CellTypes = new CellType[11 * 11];
        for (int x = 0; x < 11; x++)
        {
            for (int y = 0; y < 11; y++)
            {
                scenario.CellTypes[x + y * 11] = CellType.Plain;
            }
        }
        scenario.CellTypes[5 + 0 * 11] = CellType.Castle;
        scenario.CellTypes[5 + 5 * 11] = CellType.Castle;
        scenario.CellTypes[5 + 10 * 11] = CellType.Castle;
        
        scenario.CellTypes[4 + 5 * 11] = CellType.Forest;
        scenario.CellTypes[6 + 5 * 11] = CellType.Forest;
        scenario.CellTypes[5 + 4 * 11] = CellType.Forest;
        scenario.CellTypes[5 + 6 * 11] = CellType.Forest;
        scenario.CellTypes[3 + 5 * 11] = CellType.Forest;
        scenario.CellTypes[7 + 5 * 11] = CellType.Forest;

        List<UnitSetting> units = new List<UnitSetting>() {
            new UnitSetting(Team.Blue, new Vector2Int(3, 0), UnitType.Footman),
            new UnitSetting(Team.Blue, new Vector2Int(4, 0), UnitType.Footman),
            new UnitSetting(Team.Blue, new Vector2Int(5, 0), UnitType.King),
            new UnitSetting(Team.Blue, new Vector2Int(6, 0), UnitType.Footman),
            new UnitSetting(Team.Blue, new Vector2Int(7, 0), UnitType.Footman),
            new UnitSetting(Team.Blue, new Vector2Int(3, 1), UnitType.Footman),
            new UnitSetting(Team.Blue, new Vector2Int(4, 1), UnitType.Footman),
            new UnitSetting(Team.Blue, new Vector2Int(5, 1), UnitType.Scout),
            new UnitSetting(Team.Blue, new Vector2Int(6, 1), UnitType.Footman),
            new UnitSetting(Team.Blue, new Vector2Int(7, 1), UnitType.Footman),

            new UnitSetting(Team.Red, new Vector2Int(3, 10), UnitType.Footman),
            new UnitSetting(Team.Red, new Vector2Int(4, 10), UnitType.Footman),
            new UnitSetting(Team.Red, new Vector2Int(5, 10), UnitType.King),
            new UnitSetting(Team.Red, new Vector2Int(6, 10), UnitType.Footman),
            new UnitSetting(Team.Red, new Vector2Int(7, 10), UnitType.Footman),
            new UnitSetting(Team.Red, new Vector2Int(3, 9), UnitType.Footman),
            new UnitSetting(Team.Red, new Vector2Int(4, 9), UnitType.Footman),
            new UnitSetting(Team.Red, new Vector2Int(5, 9), UnitType.Scout),
            new UnitSetting(Team.Red, new Vector2Int(6, 9), UnitType.Footman),
            new UnitSetting(Team.Red, new Vector2Int(7, 9), UnitType.Footman),
        };
        scenario.Units = units.ToArray();
        AssetDatabase.CreateAsset(scenario, "Assets/Scenarios/Beginner.asset");
    }
}

#endif